blob: 375715dc961eeaec8816ab55882e7c57a0e9e0f0 [file] [log] [blame]
Daniel Stenbergeea22872004-03-16 07:56:51 +00001 _ _ ____ _
2 ___| | | | _ \| |
3 / __| | | | |_) | |
4 | (__| |_| | _ <| |___
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +00005 \___|\___/|_| \_\_____|
6
7FAQ
8
Daniel Stenbergc3318b42000-08-17 14:06:42 +00009 1. Philosophy
10 1.1 What is cURL?
11 1.2 What is libcurl?
Daniel Stenbergc3688002004-10-04 12:54:58 +000012 1.3 What is curl not?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000013 1.4 When will you make curl do XXXX ?
Daniel Stenbergc3688002004-10-04 12:54:58 +000014 1.5 Who makes curl?
15 1.6 What do you get for making curl?
Daniel Stenbergc528dc52001-08-07 11:17:37 +000016 1.7 What about CURL from curl.com?
Antoine Pietrib341b762022-01-27 02:12:50 +010017 1.8 I have a problem, who do I mail?
Daniel Stenberg9a44fa82005-11-02 09:34:53 +000018 1.9 Where do I buy commercial support for curl?
19 1.10 How many are using curl?
Daniel Stenberga28464a2021-10-31 16:34:44 +010020 1.11 Why do you not update ca-bundle.crt
Antoine Pietrib341b762022-01-27 02:12:50 +010021 1.12 I have a problem, who can I chat with?
Daniel Stenberg59842d42010-08-18 16:54:11 +020022 1.13 curl's ECCN number?
Daniel Stenberga5f96b42010-10-06 20:03:13 +020023 1.14 How do I submit my patch?
Daniel Stenbergf81d3562015-05-26 19:13:09 +020024 1.15 How do I port libcurl to my OS?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000025
Daniel Stenbergc3318b42000-08-17 14:06:42 +000026 2. Install Related Problems
Daniel Stenberg490879e2020-11-05 13:06:00 +010027 2.1 configure fails when using static libraries
Daniel Stenbergc3318b42000-08-17 14:06:42 +000028 2.2 Does curl work/build with other SSL libraries?
Dan Fandrich5c9fff92009-01-30 18:28:29 +000029 2.4 Does curl support SOCKS (RFC 1928) ?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000030
Daniel Stenbergc3318b42000-08-17 14:06:42 +000031 3. Usage Problems
32 3.1 curl: (1) SSL is disabled, https: not supported
33 3.2 How do I tell curl to resume a transfer?
Daniel Stenberga28464a2021-10-31 16:34:44 +010034 3.3 Why does my posting using -F not work?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000035 3.4 How do I tell curl to run custom FTP commands?
Dan Fandrichb3740f02011-06-02 18:41:57 -070036 3.5 How can I disable the Accept: */* header?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +000037 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000038 3.7 Can I use curl to delete/rename a file through FTP?
39 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberg98871d12002-05-22 22:14:03 +000040 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg147a6732001-03-08 09:25:09 +000041 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenberg88d14e92001-05-29 14:02:20 +000042 3.11 How do I POST with a different Content-Type?
dbrowndan84086b32019-05-23 15:05:29 -070043 3.12 Why do FTP-specific features over HTTP proxy fail?
44 3.13 Why do my single/double quotes fail?
Kushal Das94ac2ca2022-04-21 17:05:36 +020045 3.14 Does curl support JavaScript or PAC (automated proxy config)?
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +000046 3.15 Can I do recursive fetches with curl?
Daniel Stenbergedd16d92004-08-12 11:39:00 +000047 3.16 What certificates do I need when I use SSL?
Kushal Das94ac2ca2022-04-21 17:05:36 +020048 3.17 How do I list the root directory of an FTP server?
Daniel Stenberge9eb5232005-04-05 14:36:37 +000049 3.18 Can I use curl to send a POST/PUT and not wait for a response?
Daniel Stenberg64f12a32010-09-07 19:05:07 +020050 3.19 How do I get HTTP from a host using a specific IP address?
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +010051 3.20 How to SFTP from my user's home directory?
Daniel Stenberg0d0f8082011-03-08 11:15:59 +010052 3.21 Protocol xxx not supported or disabled in libcurl
Daniel Stenberg0ed4a092013-01-21 14:33:12 +010053 3.22 curl -X gives me HTTP problems
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000054
Daniel Stenbergc3318b42000-08-17 14:06:42 +000055 4. Running Problems
Daniel Stenberge26ee092001-01-15 10:26:37 +000056 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000057 4.3 How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberga28464a2021-10-31 16:34:44 +010058 4.4 Why do I get downloaded data even though the web page does not exist?
Daniel Stenberg3a4182d2022-03-29 13:58:11 +020059 4.5 Why do I get return code XXX from an HTTP server?
Daniel Stenbergc3318b42000-08-17 14:06:42 +000060 4.5.1 "400 Bad Request"
61 4.5.2 "401 Unauthorized"
62 4.5.3 "403 Forbidden"
63 4.5.4 "404 Not Found"
64 4.5.5 "405 Method Not Allowed"
Daniel Stenbergd60029d2001-12-19 23:25:04 +000065 4.5.6 "301 Moved Permanently"
Daniel Stenbergc3318b42000-08-17 14:06:42 +000066 4.6 Can you tell me what error code 142 means?
Daniel Stenberg490879e2020-11-05 13:06:00 +010067 4.7 How do I keep user names and passwords secret in curl command lines?
Daniel Stenberge30b2062021-12-09 12:03:35 +010068 4.8 I found a bug
Daniel Gustafsson76523102022-05-20 13:40:12 +020069 4.9 curl cannot authenticate to a server that requires NTLM?
Daniel Stenberge30b2062021-12-09 12:03:35 +010070 4.10 My HTTP request using HEAD, PUT or DELETE does not work
dbrowndan84086b32019-05-23 15:05:29 -070071 4.11 Why do my HTTP range requests return the full document?
Daniel Stenberg16077112002-11-20 19:17:43 +000072 4.12 Why do I get "certificate verify failed" ?
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +000073 4.13 Why is curl -R on Windows one hour off?
Daniel Stenberge30b2062021-12-09 12:03:35 +010074 4.14 Redirects work in browser but not with curl
Daniel Stenberga28464a2021-10-31 16:34:44 +010075 4.15 FTPS does not work
Daniel Stenberge30b2062021-12-09 12:03:35 +010076 4.16 My HTTP POST or PUT requests are slow
Daniel Stenberg2afb88e2009-02-23 21:21:00 +000077 4.17 Non-functional connect timeouts on Windows
Daniel Stenbergb8012ea2009-11-07 21:52:41 +000078 4.18 file:// URLs containing drive letters (Windows, NetWare)
Daniel Stenberga28464a2021-10-31 16:34:44 +010079 4.19 Why does not curl return an error when the network cable is unplugged?
Daniel Stenberge30b2062021-12-09 12:03:35 +010080 4.20 curl does not return error for HTTP non-200 responses
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +000081
Daniel Stenbergc3318b42000-08-17 14:06:42 +000082 5. libcurl Issues
Daniel Stenberg7d09e512001-01-11 12:52:07 +000083 5.1 Is libcurl thread-safe?
Daniel Stenberga40b55d2000-11-22 07:27:26 +000084 5.2 How can I receive all data into a large memory chunk?
Daniel Stenberg2c100372000-12-19 07:30:51 +000085 5.3 How do I fetch multiple files with libcurl?
Dan Fandrich2a264d42020-12-12 09:59:10 -080086 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg7e3cd822003-12-08 13:59:35 +000087 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg4c485992001-04-22 15:45:27 +000088 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberge30b2062021-12-09 12:03:35 +010089 5.7 Link errors when building libcurl on Windows
Daniel Stenberg9754b202010-08-11 09:15:43 +020090 5.8 libcurl.so.X: open failed: No such file or directory
Daniel Stenberg1d323362004-08-12 14:09:10 +000091 5.9 How does libcurl resolve host names?
Daniel Stenberge9eb5232005-04-05 14:36:37 +000092 5.10 How do I prevent libcurl from writing the response to stdout?
Daniel Stenberg6e8e0412005-04-05 14:38:38 +000093 5.11 How do I make libcurl not receive the whole HTTP response?
Daniel Stenbergb5d50e92005-04-11 13:39:55 +000094 5.12 Can I make libcurl fake or hide my real IP address?
Daniel Stenberg24602ed2007-12-10 10:28:56 +000095 5.13 How do I stop an ongoing transfer?
Daniel Stenberg22059852008-09-24 07:39:42 +000096 5.14 Using C++ non-static functions for callbacks?
Yang Tsea07bc792010-02-14 19:40:18 +000097 5.15 How do I get an FTP directory listing?
Daniel Stenberge30b2062021-12-09 12:03:35 +010098 5.16 I want a different time-out
Daniel Stenbergdbf93a82013-01-03 10:15:02 +010099 5.17 Can I write a server with libcurl?
Daniel Stenberg1495f422014-05-08 09:30:35 +0200100 5.18 Does libcurl use threads?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000101
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000102 6. License Issues
103 6.1 I have a GPL program, can I use the libcurl library?
104 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000105 6.3 I have a BSD licensed program, can I use the libcurl library?
106 6.4 I have a program that uses LGPL libraries, can I use libcurl?
107 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
108 6.6 Can you please change the curl/libcurl license to XXXX?
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000109 6.7 What are my obligations when using libcurl in my commercial apps?
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000110
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000111 7. PHP/CURL Issues
112 7.1 What is PHP/CURL?
Daniel Stenberge38a7882011-03-17 11:30:29 +0100113 7.2 Who wrote PHP/CURL?
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000114 7.3 Can I perform multiple requests using the same handle?
Daniel Stenberg6d496952017-05-12 19:58:06 +0200115 7.4 Does PHP/CURL have dependencies?
Daniel Stenberg9ac76292004-08-18 11:18:36 +0000116
Daniel Stenberg352b07f2021-09-13 17:21:38 +0200117 8. Development
118 8.1 Why does curl use C89?
119 8.2 Will curl be rewritten?
120
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000121==============================================================================
122
1231. Philosophy
124
125 1.1 What is cURL?
126
Daniel Stenbergc3688002004-10-04 12:54:58 +0000127 cURL is the name of the project. The name is a play on 'Client for URLs',
128 originally with URL spelled in uppercase to make it obvious it deals with
Daniel Stenberge28628f2021-12-08 10:12:19 +0100129 URLs. The fact it can also be read as 'see URL' also helped, it works as
Dan Fandrichec2ad572005-04-13 19:31:00 +0000130 an abbreviation for "Client URL Request Library" or why not the recursive
Daniel Stenberg490879e2020-11-05 13:06:00 +0100131 version: "curl URL Request Library".
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000132
Daniel Stenbergc3688002004-10-04 12:54:58 +0000133 The cURL project produces two products:
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000134
Daniel Stenbergc3688002004-10-04 12:54:58 +0000135 libcurl
136
Daniel Stenberge30b2062021-12-09 12:03:35 +0100137 A client-side URL transfer library, supporting DICT, FILE, FTP, FTPS,
138 GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S,
139 RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP.
Daniel Stenbergac20f522010-08-18 19:43:06 +0200140
Daniel Stenberg7ac16812009-01-14 22:52:18 +0000141 libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading,
Michael Osipov37f0e8a2014-08-02 13:51:18 +0100142 Kerberos, SPNEGO, HTTP form based upload, proxies, cookies, user+password
Daniel Stenberge30b2062021-12-09 12:03:35 +0100143 authentication, file transfer resume, http proxy tunneling and more.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000144
145 libcurl is highly portable, it builds and works identically on numerous
Michael Osipov37f0e8a2014-08-02 13:51:18 +0100146 platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HP-UX,
Daniel Stenberg90dd1fc2022-01-16 23:35:00 +0100147 IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, macOS,
148 Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS, Symbian, OSF, Android,
149 Minix, IBM TPF and more...
Daniel Stenbergc3688002004-10-04 12:54:58 +0000150
151 libcurl is free, thread-safe, IPv6 compatible, feature rich, well
152 supported and fast.
Gisle Vanem51a87fa2004-11-24 15:14:42 +0000153
Daniel Stenbergc3688002004-10-04 12:54:58 +0000154 curl
155
Daniel Stenberg7aa79dc2021-09-15 14:33:05 +0200156 A command line tool for getting or sending data using URL syntax.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000157
Daniel Stenbergac20f522010-08-18 19:43:06 +0200158 Since curl uses libcurl, curl supports the same wide range of common
159 Internet protocols that libcurl does.
Daniel Stenbergc3688002004-10-04 12:54:58 +0000160
Daniel Stenberg17932a82014-09-19 10:01:45 +0200161 We pronounce curl with an initial k sound. It rhymes with words like girl
162 and earl. This is a short WAV file to help you:
163
Viktor Szakats13ef6232017-08-08 19:22:34 +0000164 https://media.merriam-webster.com/soundc11/c/curl0001.wav
Daniel Stenberg887e7282001-01-03 09:13:07 +0000165
Daniel Stenbergf83be112005-05-18 10:12:08 +0000166 There are numerous sub-projects and related projects that also use the word
167 curl in the project names in various combinations, but you should take
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000168 notice that this FAQ is directed at the command-line tool named curl (and
Daniel Stenbergeea22872004-03-16 07:56:51 +0000169 libcurl the library), and may therefore not be valid for other curl-related
Daniel Stenbergf83be112005-05-18 10:12:08 +0000170 projects. (There is however a small section for the PHP/CURL in this FAQ.)
Daniel Stenberg073ef0b2003-05-09 07:07:13 +0000171
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000172 1.2 What is libcurl?
173
Daniel Stenberg5ad23d52021-10-20 09:24:18 +0200174 libcurl is a reliable and portable library for doing Internet data transfers
175 using one or more of its supported Internet protocols.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000176
Daniel Stenberge30b2062021-12-09 12:03:35 +0100177 You can use libcurl freely in your application, be it open source,
Daniel Stenbergeea22872004-03-16 07:56:51 +0000178 commercial or closed-source.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000179
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000180 libcurl is most probably the most portable, most powerful and most often
181 used C-based multi-platform file transfer library on this planet - be it
182 open source or commercial.
183
Daniel Stenbergc3688002004-10-04 12:54:58 +0000184 1.3 What is curl not?
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000185
Daniel Stenberge30b2062021-12-09 12:03:35 +0100186 curl is not a wget clone. That is a common misconception. Never, during
Daniel Stenbergeea22872004-03-16 07:56:51 +0000187 curl's development, have we intended curl to replace wget or compete on its
Daniel Stenberg490879e2020-11-05 13:06:00 +0100188 market. curl is targeted at single-shot file transfers.
Daniel Stenbergeea22872004-03-16 07:56:51 +0000189
Daniel Stenberg490879e2020-11-05 13:06:00 +0100190 curl is not a website mirroring program. If you want to use curl to mirror
191 something: fine, go ahead and write a script that wraps around curl or use
192 libcurl to make it reality.
Daniel Stenbergef34ad22000-06-02 12:45:23 +0000193
Daniel Stenberg490879e2020-11-05 13:06:00 +0100194 curl is not an FTP site mirroring program. Sure, get and send FTP with curl
Daniel Stenberg4c485992001-04-22 15:45:27 +0000195 but if you want systematic and sequential behavior you should write a
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000196 script (or write a new program that interfaces libcurl) and do it.
197
Daniel Stenberg490879e2020-11-05 13:06:00 +0100198 curl is not a PHP tool, even though it works perfectly well when used from
Daniel Stenbergc3688002004-10-04 12:54:58 +0000199 or with PHP (when using the PHP/CURL module).
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000200
Daniel Stenberg490879e2020-11-05 13:06:00 +0100201 curl is not a program for a single operating system. curl exists, compiles,
Daniel Stenberg890b34d2007-02-11 09:55:17 +0000202 builds and runs under a wide range of operating systems, including all
Daniel Stenberg90dd1fc2022-01-16 23:35:00 +0100203 modern Unixes (and a bunch of older ones too), Windows, Amiga, OS/2, macOS,
204 QNX etc.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +0000205
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000206 1.4 When will you make curl do XXXX ?
207
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000208 We love suggestions of what to change in order to make curl and libcurl
209 better. We do however believe in a few rules when it comes to the future of
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000210 curl:
211
Daniel Stenberg490879e2020-11-05 13:06:00 +0100212 curl -- the command line tool -- is to remain a non-graphical command line
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200213 tool. If you want GUIs or fancy scripting capabilities, you should look for
214 another tool that uses libcurl.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000215
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200216 We do not add things to curl that other small and available tools already do
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100217 well at the side. curl's output can be piped into another program or
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600218 redirected to another file for the next program to interpret.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000219
Viktor Szakats7e35eb72018-02-23 23:29:01 +0000220 We focus on protocol related issues and improvements. If you want to do more
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100221 magic with the supported protocols than curl currently does, chances are
222 good we will agree. If you want to add more protocols, we may agree.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000223
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600224 If you want someone else to do all the work while you wait for us to
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100225 implement it for you, that is not a friendly attitude. We spend a
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200226 considerable time already on maintaining and developing curl. In order to
227 get more out of us, you should consider trading in some of your time and
Kushal Das94ac2ca2022-04-21 17:05:36 +0200228 effort in return. Simply go to the GitHub repository which resides at
Viktor Szakats20dcd192016-02-03 18:34:16 +0100229 https://github.com/curl/curl, fork the project, and create pull requests
paulehoffman53d1e422016-01-24 14:27:08 -0800230 with your proposed changes.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000231
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600232 If you write the code, chances are better that it will get into curl faster.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000233
Daniel Stenbergc3688002004-10-04 12:54:58 +0000234 1.5 Who makes curl?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000235
Daniel Stenbergf83be112005-05-18 10:12:08 +0000236 curl and libcurl are not made by any single individual. Daniel Stenberg is
237 project leader and main developer, but other persons' submissions are
Daniel Stenbergd16c7572002-08-08 11:54:11 +0000238 important and crucial. Anyone can contribute and post their changes and
239 improvements and have them inserted in the main sources (of course on the
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600240 condition that developers agree that the fixes are good).
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000241
Daniel Stenbergdb2d52a2007-12-10 11:33:46 +0000242 The full list of all contributors is found in the docs/THANKS file.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000243
244 curl is developed by a community, with Daniel at the wheel.
245
Daniel Stenbergc3688002004-10-04 12:54:58 +0000246 1.6 What do you get for making curl?
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000247
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200248 Project cURL is entirely free and open. We do this voluntarily, mostly in
Daniel Stenberge30b2062021-12-09 12:03:35 +0100249 our spare time. Companies may pay individual developers to work on curl.
250 This is not controlled by nor supervised in any way by the curl project.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000251
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200252 We get help from companies. Haxx provides website, bandwidth, mailing lists
253 etc, GitHub hosts the primary git repository and other services like the bug
254 tracker at https://github.com/curl/curl. Also again, some companies have
255 sponsored certain parts of the development in the past and I hope some will
256 continue to do so in the future.
Daniel Stenberga0eb52b2001-03-23 15:28:13 +0000257
Daniel Stenbergf83be112005-05-18 10:12:08 +0000258 If you want to support our project, consider a donation or a banner-program
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600259 or even better: by helping us with coding, documenting or testing etc.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000260
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100261 See also: https://curl.se/sponsors.html
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200262
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000263 1.7 What about CURL from curl.com?
264
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600265 During the summer of 2001, curl.com was busy advertising their client-side
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000266 programming language for the web, named CURL.
267
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000268 We are in no way associated with curl.com or their CURL programming
Daniel Stenbergeea22872004-03-16 07:56:51 +0000269 language.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000270
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000271 Our project name curl has been in effective use since 1998. We were not the
Daniel Stenberg4045cd52001-08-07 21:21:24 +0000272 first computer related project to use the name "curl" and do not claim any
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200273 rights to the name.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000274
Daniel Stenberg81b6ebc2001-08-07 18:02:37 +0000275 We recognize that we will be living in parallel with curl.com and wish them
276 every success.
Daniel Stenbergc528dc52001-08-07 11:17:37 +0000277
Antoine Pietrib341b762022-01-27 02:12:50 +0100278 1.8 I have a problem, who do I mail?
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000279
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000280 Please do not mail any single individual unless you really need to. Keep
281 curl-related questions on a suitable mailing list. All available mailing
282 lists are listed in the MANUAL document and online at
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100283 https://curl.se/mail/
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000284
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000285 Keeping curl-related questions and discussions on mailing lists allows
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600286 others to join in and help, to share their ideas, to contribute their
287 suggestions and to spread their wisdom. Keeping discussions on public mailing
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000288 lists also allows for others to learn from this (both current and future
289 users thanks to the web based archives of the mailing lists), thus saving us
290 from having to repeat ourselves even more. Thanks for respecting this.
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000291
Daniel Stenberg0b8f57b2005-08-07 14:36:55 +0000292 If you have found or simply suspect a security problem in curl or libcurl,
Daniel Stenbergab2f27c2021-09-09 14:46:38 +0200293 submit all the details at https://hackerone.one/curl. On there we keep the
294 issue private while we investigate, confirm it, work and validate a fix and
295 agree on a time schedule for publication etc. That way we produce a fix in a
296 timely manner before the flaw is announced to the world, reducing the impact
Antoine Pietrib341b762022-01-27 02:12:50 +0100297 the problem risks having on existing users.
Daniel Stenbergab2f27c2021-09-09 14:46:38 +0200298
299 Security issues can also be taking to the curl security team by emailing
300 security at curl.se (closed list of receivers, mails are not disclosed).
Daniel Stenberg0b8f57b2005-08-07 14:36:55 +0000301
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000302 1.9 Where do I buy commercial support for curl?
303
304 curl is fully open source. It means you can hire any skilled engineer to fix
305 your curl-related problems.
306
H3RSKO3d221402020-08-16 16:36:10 -0400307 We list available alternatives on the curl website:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100308 https://curl.se/support.html
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000309
310 1.10 How many are using curl?
311
312 It is impossible to tell.
313
Daniel Stenberga28464a2021-10-31 16:34:44 +0100314 We do not know how many users that knowingly have installed and use curl.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000315
Daniel Stenberga28464a2021-10-31 16:34:44 +0100316 We do not know how many users that use curl without knowing that they are in
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000317 fact using it.
318
Daniel Stenberga28464a2021-10-31 16:34:44 +0100319 We do not know how many users that downloaded or installed curl and then
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000320 never use it.
321
Daniel Gustafssonafbf7d22020-11-05 09:36:24 +0100322 In 2020, we estimate that curl runs in roughly ten billion installations
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200323 world wide.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000324
Daniel Stenberga28464a2021-10-31 16:34:44 +0100325 1.11 Why do you not update ca-bundle.crt
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000326
Daniel Stenberga28464a2021-10-31 16:34:44 +0100327 In the cURL project we have decided not to attempt to keep this file updated
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200328 (or even present) since deciding what to add to a ca cert bundle is an
Daniel Stenberga28464a2021-10-31 16:34:44 +0100329 undertaking we have not been ready to accept, and the one we can get from
Kushal Das94ac2ca2022-04-21 17:05:36 +0200330 Mozilla is perfectly fine so there is no need to duplicate that work.
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000331
332 Today, with many services performed over HTTPS, every operating system
333 should come with a default ca cert bundle that can be deemed somewhat
334 trustworthy and that collection (if reasonably updated) should be deemed to
Daniel Stenberg074bd2a2008-02-18 11:39:11 +0000335 be a lot better than a private curl version.
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000336
Daniel Stenberg074bd2a2008-02-18 11:39:11 +0000337 If you want the most recent collection of ca certs that Mozilla Firefox
338 uses, we recommend that you extract the collection yourself from Mozilla
339 Firefox (by running 'make ca-bundle), or by using our online service setup
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100340 for this purpose: https://curl.se/docs/caextract.html
Daniel Stenberg15bf1682008-02-07 15:43:36 +0000341
Antoine Pietrib341b762022-01-27 02:12:50 +0100342 1.12 I have a problem who, can I chat with?
Daniel Stenberg8740d142009-06-09 09:02:39 +0000343
Kushal Das94ac2ca2022-04-21 17:05:36 +0200344 There is a bunch of friendly people hanging out in the #curl channel on the
Daniel Stenberga28464a2021-10-31 16:34:44 +0100345 IRC network libera.chat. If you are polite and nice, chances are good that
Daniel Stenbergb03b82a2021-05-24 00:21:00 +0200346 you can get -- or provide -- help instantly.
Daniel Stenberg8740d142009-06-09 09:02:39 +0000347
Daniel Stenberg59842d42010-08-18 16:54:11 +0200348 1.13 curl's ECCN number?
349
350 The US government restricts exports of software that contains or uses
351 cryptography. When doing so, the Export Control Classification Number (ECCN)
352 is used to identify the level of export control etc.
353
Daniel Stenbergb8235962016-01-04 18:59:29 +0100354 Apache Software Foundation gives a good explanation of ECCNs at
355 https://www.apache.org/dev/crypto.html
Daniel Stenberg59842d42010-08-18 16:54:11 +0200356
357 We believe curl's number might be ECCN 5D002, another possibility is
Daniel Stenbergb8235962016-01-04 18:59:29 +0100358 5D992. It seems necessary to write them (the authority that administers ECCN
359 numbers), asking to confirm.
Daniel Stenberg59842d42010-08-18 16:54:11 +0200360
Daniel Stenbergb8235962016-01-04 18:59:29 +0100361 Comprehensible explanations of the meaning of such numbers and how to obtain
362 them (resp.) are here
Daniel Stenberg59842d42010-08-18 16:54:11 +0200363
Viktor Szakats13ef6232017-08-08 19:22:34 +0000364 https://www.bis.doc.gov/licensing/exportingbasics.htm
365 https://www.bis.doc.gov/licensing/do_i_needaneccn.html
Daniel Stenberg59842d42010-08-18 16:54:11 +0200366
367 An incomprehensible description of the two numbers above is here
Viktor Szakatsf0783612018-09-22 07:58:05 +0000368 https://www.bis.doc.gov/index.php/documents/new-encryption/1653-ccl5-pt2-3
Daniel Stenberg59842d42010-08-18 16:54:11 +0200369
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200370 1.14 How do I submit my patch?
371
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200372 We strongly encourage you to submit changes and improvements directly as
Daniel Stenberga28464a2021-10-31 16:34:44 +0100373 "pull requests" on GitHub: https://github.com/curl/curl/pulls
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200374
Daniel Stenberga28464a2021-10-31 16:34:44 +0100375 If you for any reason cannot or will not deal with GitHub, send your patch to
376 the curl-library mailing list. We are many subscribers there and there are
Daniel Stenbergd63b3902020-09-07 17:08:07 +0200377 lots of people who can review patches, comment on them and "receive" them
378 properly.
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200379
Daniel Stenberg490879e2020-11-05 13:06:00 +0100380 Lots of more details are found in the CONTRIBUTE.md and INTERNALS.md
381 documents.
Daniel Stenberga5f96b42010-10-06 20:03:13 +0200382
Daniel Stenbergf81d3562015-05-26 19:13:09 +0200383 1.15 How do I port libcurl to my OS?
384
385 Here's a rough step-by-step:
386
387 1. copy a suitable lib/config-*.h file as a start to lib/config-[youros].h
388
389 2. edit lib/config-[youros].h to match your OS and setup
390
391 3. edit lib/curl_setup.h to include config-[youros].h when your OS is
392 detected by the preprocessor, in the style others already exist
393
394 4. compile lib/*.c and make them into a library
395
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000396
Daniel Stenbergc3318b42000-08-17 14:06:42 +00003972. Install Related Problems
398
Daniel Stenberg490879e2020-11-05 13:06:00 +0100399 2.1 configure fails when using static libraries
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000400
Daniel Stenberg490879e2020-11-05 13:06:00 +0100401 You may find that configure fails to properly detect the entire dependency
402 chain of libraries when you provide static versions of the libraries that
403 configure checks for.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000404
Daniel Stenberg490879e2020-11-05 13:06:00 +0100405 The reason why static libraries is much harder to deal with is that for them
Daniel Stenberga28464a2021-10-31 16:34:44 +0100406 we do not get any help but the script itself must know or check what more
Daniel Stenberg490879e2020-11-05 13:06:00 +0100407 libraries that are needed (with shared libraries, that dependency "chain" is
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100408 handled automatically). This is a error-prone process and one that also
Daniel Stenberg490879e2020-11-05 13:06:00 +0100409 tends to vary over time depending on the release versions of the involved
410 components and may also differ between operating systems.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000411
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100412 For that reason, configure does few attempts to actually figure this out and
413 you are instead encouraged to set LIBS and LDFLAGS accordingly when you
414 invoke configure, and point out the needed libraries and set the necessary
415 flags yourself.
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000416
Daniel Stenberg490879e2020-11-05 13:06:00 +0100417 2.2 Does curl work with other SSL libraries?
Daniel Stenberg7c37c6a2000-05-22 17:35:35 +0000418
Daniel Stenberg490879e2020-11-05 13:06:00 +0100419 curl has been written to use a generic SSL function layer internally, and
Daniel Stenberg045c7342013-01-23 13:17:36 +0100420 that SSL functionality can then be provided by one out of many different SSL
421 backends.
422
423 curl can be built to use one of the following SSL alternatives: OpenSSL,
Daniel Stenberg223f26c2022-01-09 22:28:48 +0100424 libressl, BoringSSL, GnuTLS, wolfSSL, NSS, mbedTLS, Secure
Michael Forney9b879162019-11-07 20:17:18 -0800425 Transport (native iOS/OS X), Schannel (native Windows), GSKit (native IBM
Jacob Hoffman-Andrews246399a2020-12-12 23:55:09 -0800426 i), BearSSL, or Rustls. They all have their pros and cons, and we try to
427 maintain a comparison of them here: https://curl.se/docs/ssl-compared.html
Daniel Stenberge9640b62000-08-02 07:17:56 +0000428
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000429 2.4 Does curl support SOCKS (RFC 1928) ?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000430
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000431 Yes, SOCKS 4 and 5 are supported.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000432
Daniel Stenbergc3318b42000-08-17 14:06:42 +00004333. Usage problems
Daniel Stenberge9640b62000-08-02 07:17:56 +0000434
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000435 3.1 curl: (1) SSL is disabled, https: not supported
Daniel Stenberge9640b62000-08-02 07:17:56 +0000436
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200437 If you get this output when trying to get anything from an https:// server,
Daniel Stenberga28464a2021-10-31 16:34:44 +0100438 it means that the instance of curl/libcurl that you are using was built
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100439 without support for this protocol.
440
Daniel Stenberga28464a2021-10-31 16:34:44 +0100441 This could have happened if the configure script that was run at build time
442 could not find all libs and include files curl requires for SSL to work. If
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100443 the configure script fails to find them, curl is simply built without SSL
444 support.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000445
446 To get the https:// support into a curl that was previously built but that
447 reports that https:// is not supported, you should dig through the document
Daniel Stenberga28464a2021-10-31 16:34:44 +0100448 and logs and check out why the configure script does not find the SSL libs
Daniel Stenberge9640b62000-08-02 07:17:56 +0000449 and/or include files.
450
Daniel Stenberga28464a2021-10-31 16:34:44 +0100451 Also, check out the other paragraph in this FAQ labeled "configure does not
Daniel Stenberge9640b62000-08-02 07:17:56 +0000452 find OpenSSL even when it is installed".
453
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000454 3.2 How do I tell curl to resume a transfer?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000455
Daniel Stenberg490879e2020-11-05 13:06:00 +0100456 curl supports resumed transfers both ways on both FTP and HTTP.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000457 Try the -C option.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000458
Daniel Stenberga28464a2021-10-31 16:34:44 +0100459 3.3 Why does my posting using -F not work?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000460
Daniel Stenberga28464a2021-10-31 16:34:44 +0100461 You cannot arbitrarily use -F or -d, the choice between -F or -d depends on
Daniel Stenberg490879e2020-11-05 13:06:00 +0100462 the HTTP operation you need curl to do and what the web server that will
463 receive your post expects.
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600464
Daniel Stenberga28464a2021-10-31 16:34:44 +0100465 If the form you are trying to submit uses the type 'multipart/form-data',
Daniel Stenberg490879e2020-11-05 13:06:00 +0100466 then and only then you must use the -F type. In all the most common cases,
467 you should use -d which then causes a posting with the type
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600468 'application/x-www-form-urlencoded'.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000469
Daniel Stenberg4c485992001-04-22 15:45:27 +0000470 This is described in some detail in the MANUAL and TheArtOfHttpScripting
Daniel Stenberga28464a2021-10-31 16:34:44 +0100471 documents, and if you do not understand it the first time, read it again
Daniel Stenberg4c485992001-04-22 15:45:27 +0000472 before you post questions about this to the mailing list. Also, try reading
473 through the mailing list archives for old postings and questions regarding
474 this.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000475
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000476 3.4 How do I tell curl to run custom FTP commands?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000477
478 You can tell curl to perform optional commands both before and/or after a
479 file transfer. Study the -Q/--quote option.
480
Daniel Stenberga28464a2021-10-31 16:34:44 +0100481 Since curl is used for file transfers, you do not normally use curl to
Daniel Stenberg68e2c9a2012-11-25 19:44:49 +0100482 perform FTP commands without transferring anything. Therefore you must
483 always specify a URL to transfer to/from even when doing custom FTP
484 commands, or use -I which implies the "no body" option sent to libcurl.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000485
Dan Fandrichb3740f02011-06-02 18:41:57 -0700486 3.5 How can I disable the Accept: */* header?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000487
488 You can change all internally generated headers by adding a replacement with
489 the -H/--header option. By adding a header with empty contents you safely
Dan Fandrichb3740f02011-06-02 18:41:57 -0700490 disable that one. Use -H "Accept:" to disable that specific header.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000491
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000492 3.6 Does curl support ASP, XML, XHTML or HTML version Y?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000493
Daniel Stenberga28464a2021-10-31 16:34:44 +0100494 To curl, all contents are alike. It does not matter how the page was
Daniel Stenberg07f97802013-02-08 09:58:23 +0100495 generated. It may be ASP, PHP, Perl, shell-script, SSI or plain HTML
Kushal Das94ac2ca2022-04-21 17:05:36 +0200496 files. There is no difference to curl and it does not even know what kind of
Daniel Stenberg07f97802013-02-08 09:58:23 +0100497 language that generated the page.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000498
Kushal Das94ac2ca2022-04-21 17:05:36 +0200499 See also item 3.14 regarding JavaScript.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000500
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000501 3.7 Can I use curl to delete/rename a file through FTP?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000502
Daniel Stenberg4c485992001-04-22 15:45:27 +0000503 Yes. You specify custom FTP commands with -Q/--quote.
Daniel Stenberge9640b62000-08-02 07:17:56 +0000504
505 One example would be to delete a file after you have downloaded it:
506
507 curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
508
Daniel Stenberg33b9daa2007-06-26 21:53:46 +0000509 or rename a file after upload:
510
511 curl -T infile ftp://upload.com/dir/ -Q "-RNFR infile" -Q "-RNTO newname"
512
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000513 3.8 How do I tell curl to follow HTTP redirects?
Daniel Stenberge9640b62000-08-02 07:17:56 +0000514
Daniel Stenberg490879e2020-11-05 13:06:00 +0100515 curl does not follow so-called redirects by default. The Location: header
Daniel Stenberga28464a2021-10-31 16:34:44 +0100516 that informs the client about this is only interpreted if you are using the
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000517 -L/--location option. As in:
Daniel Stenberge9640b62000-08-02 07:17:56 +0000518
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000519 curl -L http://redirector.com
520
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000521 Not all redirects are HTTP ones, see 4.14
522
Daniel Stenberg98871d12002-05-22 22:14:03 +0000523 3.9 How do I use curl in my favorite programming language?
Daniel Stenberg368e3522001-01-29 10:16:21 +0000524
dbrowndan84086b32019-05-23 15:05:29 -0700525 Many programming languages have interfaces/bindings that allow you to use
526 curl without having to use the command line tool. If you are fluent in such
527 a language, you may prefer to use one of these interfaces instead.
Daniel Stenberg4c485992001-04-22 15:45:27 +0000528
Daniel Stenberg4c485992001-04-22 15:45:27 +0000529 Find out more about which languages that support curl directly, and how to
H3RSKO3d221402020-08-16 16:36:10 -0400530 install and use them, in the libcurl section of the curl website:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100531 https://curl.se/libcurl/
Daniel Stenberg368e3522001-01-29 10:16:21 +0000532
Daniel Stenberg832e8272011-06-13 19:02:38 +0200533 All the various bindings to libcurl are made by other projects and people,
534 outside of the cURL project. The cURL project itself only produces libcurl
Daniel Stenberga28464a2021-10-31 16:34:44 +0100535 with its plain C API. If you do not find anywhere else to ask you can ask
Daniel Stenberg832e8272011-06-13 19:02:38 +0200536 about bindings on the curl-library list too, but be prepared that people on
537 that list may not know anything about bindings.
538
Daniel Stenberge30b2062021-12-09 12:03:35 +0100539 In December 2021, there were interfaces available for the following
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100540 languages: Ada95, Basic, C, C++, Ch, Cocoa, D, Delphi, Dylan, Eiffel,
541 Euphoria, Falcon, Ferite, Gambas, glib/GTK+, Go, Guile, Harbour, Haskell,
542 Java, Julia, Lisp, Lua, Mono, .NET, node.js, Object-Pascal, OCaml, Pascal,
543 Perl, PHP, PostgreSQL, Python, R, Rexx, Ring, RPG, Ruby, Rust, Scheme,
544 Scilab, S-Lang, Smalltalk, SP-Forth, SPL, Tcl, Visual Basic, Visual FoxPro,
545 Q, wxwidgets, XBLite and Xoho. By the time you read this, additional ones
Daniel Stenberge30b2062021-12-09 12:03:35 +0100546 may have appeared.
Daniel Stenberg368e3522001-01-29 10:16:21 +0000547
Daniel Stenberg147a6732001-03-08 09:25:09 +0000548 3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000549
Daniel Stenberg490879e2020-11-05 13:06:00 +0100550 curl adheres to the HTTP spec, which basically means you can play with *any*
Daniel Stenberg4c485992001-04-22 15:45:27 +0000551 protocol that is built on top of HTTP. Protocols such as SOAP, WEBDAV and
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000552 XML-RPC are all such ones. You can use -X to set custom requests and -H to
553 set custom headers (or replace internally generated ones).
554
Daniel Stenberga28464a2021-10-31 16:34:44 +0100555 Using libcurl is of course just as good and you would just use the proper
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000556 library options to do the same.
Daniel Stenbergc59baa02001-02-12 10:05:09 +0000557
Daniel Stenberg88d14e92001-05-29 14:02:20 +0000558 3.11 How do I POST with a different Content-Type?
559
560 You can always replace the internally generated headers with -H/--header.
561 To make a simple HTTP POST with text/xml as content-type, do something like:
562
563 curl -d "datatopost" -H "Content-Type: text/xml" [URL]
564
dbrowndan84086b32019-05-23 15:05:29 -0700565 3.12 Why do FTP-specific features over HTTP proxy fail?
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000566
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200567 Because when you use an HTTP proxy, the protocol spoken on the network will
568 be HTTP, even if you specify an FTP URL. This effectively means that you
Daniel Stenberga28464a2021-10-31 16:34:44 +0100569 normally cannot use FTP-specific features such as FTP upload and FTP quote
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000570 etc.
571
572 There is one exception to this rule, and that is if you can "tunnel through"
Daniel Stenberg271f96f2001-11-20 08:03:01 +0000573 the given HTTP proxy. Proxy tunneling is enabled with a special option (-p)
Daniel Stenberg97a8c982001-12-21 08:10:34 +0000574 and is generally not available as proxy admins usually disable tunneling to
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600575 ports other than 443 (which is used for HTTPS access through proxies).
Daniel Stenberg7d3daa52001-10-23 10:12:00 +0000576
dbrowndan84086b32019-05-23 15:05:29 -0700577 3.13 Why do my single/double quotes fail?
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000578
579 To specify a command line option that includes spaces, you might need to
580 put the entire option within quotes. Like in:
581
582 curl -d " with spaces " url.com
Daniel Stenbergeea22872004-03-16 07:56:51 +0000583
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000584 or perhaps
585
586 curl -d ' with spaces ' url.com
587
588 Exactly what kind of quotes and how to do this is entirely up to the shell
Daniel Stenberg98871d12002-05-22 22:14:03 +0000589 or command line interpreter that you are using. For most unix shells, you
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000590 can more or less pick either single (') or double (") quotes. For
Jay Satiroa61eac62022-05-09 02:22:39 -0400591 Windows/DOS command prompts you must use double (") quotes, and if the
592 option string contains inner double quotes you can escape them with a
593 backslash.
594
595 For Windows powershell the arguments are not always passed on as expected
596 because curl is not a powershell script. You may or may not be able to use
597 single quotes. To escape inner double quotes seems to require a
598 backslash-backtick escape sequence and the outer quotes as double quotes.
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000599
Daniel Stenberg98871d12002-05-22 22:14:03 +0000600 Please study the documentation for your particular environment. Examples in
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600601 the curl docs will use a mix of both of these as shown above. You must
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000602 adjust them to work in your environment.
603
Daniel Stenberg61f62842002-03-11 08:39:00 +0000604 Remember that curl works and runs on more operating systems than most single
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000605 individuals have ever tried.
606
Kushal Das94ac2ca2022-04-21 17:05:36 +0200607 3.14 Does curl support JavaScript or PAC (automated proxy config)?
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000608
Kushal Das94ac2ca2022-04-21 17:05:36 +0200609 Many web pages do magic stuff using embedded JavaScript. curl and libcurl
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000610 have no built-in support for that, so it will be treated just like any other
611 contents.
612
Jan-Piet Mens09c80742022-01-30 12:57:24 +0100613 .pac files are a Netscape invention and are sometimes used by organizations
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000614 to allow them to differentiate which proxies to use. The .pac contents is
Kushal Das94ac2ca2022-04-21 17:05:36 +0200615 just a JavaScript program that gets invoked by the browser and that returns
616 the name of the proxy to connect to. Since curl does not support JavaScript,
Daniel Stenberga28464a2021-10-31 16:34:44 +0100617 it cannot support .pac proxy configuration either.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000618
Kushal Das94ac2ca2022-04-21 17:05:36 +0200619 Some workarounds usually suggested to overcome this JavaScript dependency:
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000620
Kushal Das94ac2ca2022-04-21 17:05:36 +0200621 Depending on the JavaScript complexity, write up a script that translates it
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200622 to another language and execute that.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000623
Kushal Das94ac2ca2022-04-21 17:05:36 +0200624 Read the JavaScript code and rewrite the same logic in another language.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000625
Kushal Das94ac2ca2022-04-21 17:05:36 +0200626 Implement a JavaScript interpreter, people have successfully used the
627 Mozilla JavaScript engine in the past.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000628
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200629 Ask your admins to stop this, for a static proxy setup or similar.
Daniel Stenberg48bc73c2002-05-21 13:53:32 +0000630
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000631 3.15 Can I do recursive fetches with curl?
632
633 No. curl itself has no code that performs recursive operations, such as
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000634 those performed by wget and similar tools.
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000635
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600636 There exists wrapper scripts with that functionality (for example the
Daniel Stenbergf3e5d4a2003-12-22 17:24:21 +0000637 curlmirror perl script), and you can write programs based on libcurl to do
638 it, but the command line tool curl itself cannot.
Daniel Stenberg6b1a1a62002-03-11 08:29:26 +0000639
Daniel Stenbergedd16d92004-08-12 11:39:00 +0000640 3.16 What certificates do I need when I use SSL?
Daniel Stenberg43563562004-08-12 11:02:01 +0000641
642 There are three different kinds of "certificates" to keep track of when we
643 talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl.
644
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200645 CLIENT CERTIFICATE
Daniel Stenberg43563562004-08-12 11:02:01 +0000646
Daniel Stenberg6d496952017-05-12 19:58:06 +0200647 The server you communicate with may require that you can provide this in
Daniel Stenberge30b2062021-12-09 12:03:35 +0100648 order to prove that you actually are who you claim to be. If the server
Daniel Stenberga28464a2021-10-31 16:34:44 +0100649 does not require this, you do not need a client certificate.
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200650
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200651 A client certificate is always used together with a private key, and the
652 private key has a pass phrase that protects it.
Daniel Stenberg43563562004-08-12 11:02:01 +0000653
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200654 SERVER CERTIFICATE
Daniel Stenberg43563562004-08-12 11:02:01 +0000655
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200656 The server you communicate with has a server certificate. You can and should
657 verify this certificate to make sure that you are truly talking to the real
658 server and not a server impersonating it.
659
660 CERTIFICATE AUTHORITY CERTIFICATE ("CA cert")
661
662 You often have several CA certs in a CA cert bundle that can be used to
663 verify a server certificate that was signed by one of the authorities in the
664 bundle. curl does not come with a CA cert bundle but most curl installs
665 provide one. You can also override the default.
666
667 The server certificate verification process is made by using a Certificate
668 Authority certificate ("CA cert") that was used to sign the server
669 certificate. Server certificate verification is enabled by default in curl
670 and libcurl and is often the reason for problems as explained in FAQ entry
671 4.12 and the SSLCERTS document
Daniel Stenberg4d2f8002020-11-04 14:02:01 +0100672 (https://curl.se/docs/sslcerts.html). Server certificates that are
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200673 "self-signed" or otherwise signed by a CA that you do not have a CA cert
674 for, cannot be verified. If the verification during a connect fails, you are
675 refused access. You then need to explicitly disable the verification to
676 connect to the server.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000677
Kushal Das94ac2ca2022-04-21 17:05:36 +0200678 3.17 How do I list the root directory of an FTP server?
Daniel Stenberg951fdeb2004-12-21 09:37:55 +0000679
680 There are two ways. The way defined in the RFC is to use an encoded slash
Kushal Das94ac2ca2022-04-21 17:05:36 +0200681 in the first path part. List the "/tmp" directory like this:
Daniel Stenberg951fdeb2004-12-21 09:37:55 +0000682
683 curl ftp://ftp.sunet.se/%2ftmp/
684
685 or the not-quite-kosher-but-more-readable way, by simply starting the path
686 section of the URL with a slash:
687
688 curl ftp://ftp.sunet.se//tmp/
689
Daniel Stenberge9eb5232005-04-05 14:36:37 +0000690 3.18 Can I use curl to send a POST/PUT and not wait for a response?
Yang Tsea07bc792010-02-14 19:40:18 +0000691
Daniel Stenberge9eb5232005-04-05 14:36:37 +0000692 No.
693
Daniel Stenberge30b2062021-12-09 12:03:35 +0100694 You can easily write your own program using libcurl to do such stunts.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +0000695
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200696 3.19 How do I get HTTP from a host using a specific IP address?
697
Daniel Stenberga28464a2021-10-31 16:34:44 +0100698 For example, you may be trying out a website installation that is not yet in
Daniel Stenberg64f12a32010-09-07 19:05:07 +0200699 the DNS. Or you have a site using multiple IP addresses for a given host
700 name and you want to address a specific one out of the set.
701
702 Set a custom Host: header that identifies the server name you want to reach
703 but use the target IP address in the URL:
704
705 curl --header "Host: www.example.com" http://127.0.0.1/
706
Daniel Stenberg50d88bf2011-12-07 23:08:15 +0100707 You can also opt to add faked host name entries to curl with the --resolve
708 option. That has the added benefit that things like redirects will also work
709 properly. The above operation would instead be done as:
710
711 curl --resolve www.example.com:80:127.0.0.1 http://www.example.com/
712
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100713 3.20 How to SFTP from my user's home directory?
714
715 Contrary to how FTP works, SFTP and SCP URLs specify the exact directory to
Daniel Stenberga28464a2021-10-31 16:34:44 +0100716 work with. It means that if you do not specify that you want the user's home
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100717 directory, you get the actual root directory.
718
719 To specify a file in your user's home directory, you need to use the correct
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100720 URL syntax which for SFTP might look similar to:
Daniel Stenberg3f7b7de2011-03-07 22:27:26 +0100721
722 curl -O -u user:password sftp://example.com/~/file.txt
723
724 and for SCP it is just a different protocol prefix:
725
726 curl -O -u user:password scp://example.com/~/file.txt
727
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100728 3.21 Protocol xxx not supported or disabled in libcurl
729
730 When passing on a URL to curl to use, it may respond that the particular
731 protocol is not supported or disabled. The particular way this error message
Daniel Stenberga28464a2021-10-31 16:34:44 +0100732 is phrased is because curl does not make a distinction internally of whether
Dan Fandrich31c6e7a2013-04-15 22:26:18 +0200733 a particular protocol is not supported (i.e. never got any code added that
Daniel Stenberg0d0f8082011-03-08 11:15:59 +0100734 knows how to speak that protocol) or if it was explicitly disabled. curl can
735 be built to only support a given set of protocols, and the rest would then
736 be disabled or not supported.
737
738 Note that this error will also occur if you pass a wrongly spelled protocol
739 part as in "htpt://example.com" or as in the less evident case if you prefix
740 the protocol part with a space as in " http://example.com/".
741
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100742 3.22 curl -X gives me HTTP problems
743
744 In normal circumstances, -X should hardly ever be used.
745
746 By default you use curl without explicitly saying which request method to
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200747 use when the URL identifies an HTTP transfer. If you just pass in a URL like
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100748 "curl http://example.com" it will use GET. If you use -d or -F curl will use
749 POST, -I will cause a HEAD and -T will make it a PUT.
750
Daniel Stenberga28464a2021-10-31 16:34:44 +0100751 If for whatever reason you are not happy with these default choices that curl
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100752 does for you, you can override those request methods by specifying -X
753 [WHATEVER]. This way you can for example send a DELETE by doing "curl -X
754 DELETE [URL]".
755
756 It is thus pointless to do "curl -XGET [URL]" as GET would be used
757 anyway. In the same vein it is pointless to do "curl -X POST -d data
758 [URL]"... But you can make a fun and somewhat rare request that sends a
759 request-body in a GET request with something like "curl -X GET -d data
760 [URL]"
761
Daniel Stenberga28464a2021-10-31 16:34:44 +0100762 Note that -X does not actually change curl's behavior as it only modifies the
Daniel Stenberg7b534842015-02-02 15:38:29 +0100763 actual string sent in the request, but that may of course trigger a
764 different set of events.
Daniel Stenberg0ed4a092013-01-21 14:33:12 +0100765
766 Accordingly, by using -XPOST on a command line that for example would follow
767 a 303 redirect, you will effectively prevent curl from behaving
768 correctly. Be aware.
769
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000770
Daniel Stenbergc3318b42000-08-17 14:06:42 +00007714. Running Problems
772
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000773 4.2 Why do I get problems when I use & or % in the URL?
Daniel Stenberg29470102000-06-02 13:32:01 +0000774
Kushal Das94ac2ca2022-04-21 17:05:36 +0200775 In general Unix shells, the & symbol is treated specially and when used, it
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000776 runs the specified command in the background. To safely send the & as a part
Daniel Stenberg4c485992001-04-22 15:45:27 +0000777 of a URL, you should quote the entire URL by using single (') or double (")
Dan Fandrich5c9fff92009-01-30 18:28:29 +0000778 quotes around it. Similar problems can also occur on some shells with other
Daniel Stenberge30b2062021-12-09 12:03:35 +0100779 characters, including ?*!$~(){}<>\|;`. When in doubt, quote the URL.
Daniel Stenberg29470102000-06-02 13:32:01 +0000780
Daniel Stenberg07d46882009-02-13 09:12:52 +0000781 An example that would invoke a remote CGI that uses &-symbols could be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000782
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000783 curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000784
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200785 In Windows, the standard DOS shell treats the percent sign specially and you
786 need to use TWO percent signs for each single one you want to use in the
787 URL.
Daniel Stenberge26ee092001-01-15 10:26:37 +0000788
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200789 If you want a literal percent sign to be part of the data you pass in a POST
790 using -d/--data you must encode it as '%25' (which then also needs the
791 percent sign doubled on Windows machines).
Daniel Stenberg1b77c182001-01-29 10:24:51 +0000792
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000793 4.3 How can I use {, }, [ or ] to specify multiple URLs?
Daniel Stenberg29470102000-06-02 13:32:01 +0000794
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600795 Because those letters have a special meaning to the shell, to be used in
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000796 a URL specified to curl you must quote them.
Daniel Stenberg29470102000-06-02 13:32:01 +0000797
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600798 An example that downloads two URLs (sequentially) would be:
Daniel Stenberg8f037322000-06-06 14:09:01 +0000799
Daniel Stenbergedcd5df2000-06-06 14:13:36 +0000800 curl '{curl,www}.haxx.se'
Daniel Stenberg8f037322000-06-06 14:09:01 +0000801
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600802 To be able to use those characters as actual parts of the URL (without using
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +0000803 them for the curl URL "globbing" system), use the -g/--globoff option:
Daniel Stenberge26ee092001-01-15 10:26:37 +0000804
805 curl -g 'www.site.com/weirdname[].html'
806
Daniel Stenberga28464a2021-10-31 16:34:44 +0100807 4.4 Why do I get downloaded data even though the web page does not exist?
Daniel Stenberg29470102000-06-02 13:32:01 +0000808
Daniel Stenberga28464a2021-10-31 16:34:44 +0100809 curl asks remote servers for the page you specify. If the page does not exist
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000810 at the server, the HTTP protocol defines how the server should respond and
Daniel Stenberga28464a2021-10-31 16:34:44 +0100811 that means that headers and a "page" will be returned. That is simply how
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000812 HTTP works.
Daniel Stenberg29470102000-06-02 13:32:01 +0000813
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000814 By using the --fail option you can tell curl explicitly to not get any data
Daniel Stenberga28464a2021-10-31 16:34:44 +0100815 if the HTTP return code does not say success.
Daniel Stenberg8f037322000-06-06 14:09:01 +0000816
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200817 4.5 Why do I get return code XXX from an HTTP server?
Daniel Stenberg29470102000-06-02 13:32:01 +0000818
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000819 RFC2616 clearly explains the return codes. This is a short transcript. Go
820 read the RFC for exact details:
Daniel Stenberg29470102000-06-02 13:32:01 +0000821
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000822 4.5.1 "400 Bad Request"
Daniel Stenberg29470102000-06-02 13:32:01 +0000823
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000824 The request could not be understood by the server due to malformed
825 syntax. The client SHOULD NOT repeat the request without modifications.
826
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000827 4.5.2 "401 Unauthorized"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000828
829 The request requires user authentication.
830
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000831 4.5.3 "403 Forbidden"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000832
Viktor Szakatsff9d7f42018-10-08 19:37:40 +0000833 The server understood the request, but is refusing to fulfill it.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000834 Authorization will not help and the request SHOULD NOT be repeated.
835
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000836 4.5.4 "404 Not Found"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000837
838 The server has not found anything matching the Request-URI. No indication
Antoine Pietrib341b762022-01-27 02:12:50 +0100839 is given as to whether the condition is temporary or permanent.
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000840
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000841 4.5.5 "405 Method Not Allowed"
Daniel Stenbergc3318b42000-08-17 14:06:42 +0000842
843 The method specified in the Request-Line is not allowed for the resource
844 identified by the Request-URI. The response MUST include an Allow header
845 containing a list of valid methods for the requested resource.
846
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000847 4.5.6 "301 Moved Permanently"
Daniel Stenbergeea22872004-03-16 07:56:51 +0000848
Daniel Stenberg98871d12002-05-22 22:14:03 +0000849 If you get this return code and an HTML output similar to this:
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000850
851 <H1>Moved Permanently</H1> The document has moved <A
852 HREF="http://same_url_now_with_a_trailing_slash/">here</A>.
853
dbrowndan84086b32019-05-23 15:05:29 -0700854 it might be because you requested a directory URL but without the trailing
Daniel Stenbergd60029d2001-12-19 23:25:04 +0000855 slash. Try the same operation again _with_ the trailing URL, or use the
856 -L/--location option to follow the redirection.
857
Daniel Stenberg811edcd2004-08-10 08:41:41 +0000858 4.6 Can you tell me what error code 142 means?
Daniel Stenberg29470102000-06-02 13:32:01 +0000859
Daniel Stenberg8b5f0ab2004-12-21 21:35:00 +0000860 All curl error codes are described at the end of the man page, in the
861 section called "EXIT CODES".
862
863 Error codes that are larger than the highest documented error code means
Daniel Stenberg13bf9642001-08-23 11:11:13 +0000864 that curl has exited due to a crash. This is a serious error, and we
Daniel Stenberg25fe47f2001-11-14 20:13:38 +0000865 appreciate a detailed bug report from you that describes how we could go
Daniel Stenberge30b2062021-12-09 12:03:35 +0100866 ahead and repeat this.
Daniel Stenberg29470102000-06-02 13:32:01 +0000867
Daniel Stenberg490879e2020-11-05 13:06:00 +0100868 4.7 How do I keep user names and passwords secret in curl command lines?
Daniel Stenberg29470102000-06-02 13:32:01 +0000869
Daniel Stenberg11d718b2001-03-13 11:47:30 +0000870 This problem has two sides:
Daniel Stenberg29470102000-06-02 13:32:01 +0000871
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000872 The first part is to avoid having clear-text passwords in the command line
Daniel Stenberga28464a2021-10-31 16:34:44 +0100873 so that they do not appear in 'ps' outputs and similar. That is easily
Daniel Stenbergeea22872004-03-16 07:56:51 +0000874 avoided by using the "-K" option to tell curl to read parameters from a file
875 or stdin to which you can pass the secret info. curl itself will also
876 attempt to "hide" the given password by blanking out the option - this
Daniel Stenberga28464a2021-10-31 16:34:44 +0100877 does not work on all platforms.
Daniel Stenberg29470102000-06-02 13:32:01 +0000878
Daniel Stenbergc3c77392000-07-31 22:42:34 +0000879 To keep the passwords in your account secret from the rest of the world is
880 not a task that curl addresses. You could of course encrypt them somehow to
881 at least hide them from being read by human eyes, but that is not what
882 anyone would call security.
Daniel Stenberg29470102000-06-02 13:32:01 +0000883
Daniel Stenbergeea22872004-03-16 07:56:51 +0000884 Also note that regular HTTP (using Basic authentication) and FTP passwords
dbrowndan84086b32019-05-23 15:05:29 -0700885 are sent as cleartext across the network. All it takes for anyone to fetch
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100886 them is to listen on the network. Eavesdropping is easy. Use more secure
Daniel Stenbergeea22872004-03-16 07:56:51 +0000887 authentication methods (like Digest, Negotiate or even NTLM) or consider the
888 SSL-based alternatives HTTPS and FTPS.
Daniel Stenberg887e7282001-01-03 09:13:07 +0000889
Daniel Stenberge30b2062021-12-09 12:03:35 +0100890 4.8 I found a bug
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000891
Daniel Stenberg4c485992001-04-22 15:45:27 +0000892 It is not a bug if the behavior is documented. Read the docs first.
Daniel Stenberge30b2062021-12-09 12:03:35 +0100893 Especially check out the KNOWN_BUGS file, it may be a documented bug.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000894
Daniel Stenberga28464a2021-10-31 16:34:44 +0100895 If it is a problem with a binary you have downloaded or a package for your
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000896 particular platform, try contacting the person who built the package/archive
897 you have.
898
Daniel Stenberg8eaa7fe2002-04-27 18:12:26 +0000899 If there is a bug, read the BUGS document first. Then report it as described
900 in there.
Daniel Stenberg09ba8562000-10-27 12:25:00 +0000901
Daniel Gustafsson76523102022-05-20 13:40:12 +0200902 4.9 curl cannot authenticate to a server that requires NTLM?
Daniel Stenberg2c100372000-12-19 07:30:51 +0000903
Bill Nagel497e7c92016-07-07 08:40:45 -0700904 NTLM support requires OpenSSL, GnuTLS, mbedTLS, NSS, Secure Transport, or
905 Microsoft Windows libraries at build-time to provide this functionality.
Daniel Stenberg3a552b12003-06-26 11:35:48 +0000906
Daniel Stenberge30b2062021-12-09 12:03:35 +0100907 4.10 My HTTP request using HEAD, PUT or DELETE does not work
Daniel Stenbergbc743752002-05-15 21:40:29 +0000908
909 Many web servers allow or demand that the administrator configures the
910 server properly for these requests to work on the web server.
911
912 Some servers seem to support HEAD only on certain kinds of URLs.
913
914 To fully grasp this, try the documentation for the particular server
Daniel Stenberga28464a2021-10-31 16:34:44 +0100915 software you are trying to interact with. This is not anything curl can do
Daniel Stenbergbc743752002-05-15 21:40:29 +0000916 anything about.
917
dbrowndan84086b32019-05-23 15:05:29 -0700918 4.11 Why do my HTTP range requests return the full document?
Daniel Stenberg522b85a2002-11-12 20:00:02 +0000919
920 Because the range may not be supported by the server, or the server may
921 choose to ignore it and return the full document anyway.
Daniel Stenbergbc743752002-05-15 21:40:29 +0000922
Daniel Stenberg16077112002-11-20 19:17:43 +0000923 4.12 Why do I get "certificate verify failed" ?
924
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100925 When you invoke curl and get an error 60 error back it means that curl
Daniel Stenberga28464a2021-10-31 16:34:44 +0100926 could not verify that the server's certificate was good. curl verifies the
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100927 certificate using the CA cert bundle and verifying for which names the
Dan Fandrich2a264d42020-12-12 09:59:10 -0800928 certificate has been granted.
Daniel Stenberg16077112002-11-20 19:17:43 +0000929
Dan Fandrich2a264d42020-12-12 09:59:10 -0800930 To completely disable the certificate verification, use -k. This does
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100931 however enable man-in-the-middle attacks and makes the transfer INSECURE.
Antoine Pietrib341b762022-01-27 02:12:50 +0100932 We strongly advise against doing this for more than experiments.
Daniel Stenberg16077112002-11-20 19:17:43 +0000933
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100934 If you get this failure with a CA cert bundle installed and used, the
Bruno Baguette0d380a82021-11-26 08:23:34 +0100935 server's certificate might not be signed by one of the CA's in your CA
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100936 store. It might for example be self-signed. You then correct this problem by
937 obtaining a valid CA cert for the server. Or again, decrease the security by
938 disabling this check.
Daniel Stenberg16077112002-11-20 19:17:43 +0000939
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100940 At times, you find that the verification works in your favorite browser but
941 fails in curl. When this happens, the reason is usually that the server
942 sends an incomplete cert chain. The server is mandated to send all
Daniel Stenberga28464a2021-10-31 16:34:44 +0100943 "intermediate certificates" but does not. This typically works with browsers
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100944 anyway since they A) cache such certs and B) supports AIA which downloads
945 such missing certificates on demand. This is a server misconfiguration. A
946 good way to figure out if this is the case it to use the SSL Labs server
947 test and check the certificate chain: https://www.ssllabs.com/ssltest/
Daniel Stenberg16077112002-11-20 19:17:43 +0000948
Daniel Stenberg3864ad32020-11-06 09:16:06 +0100949 Details are also in the SSLCERTS.md document, found online here:
950 https://curl.se/docs/sslcerts.html
Daniel Stenberg16077112002-11-20 19:17:43 +0000951
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +0000952 4.13 Why is curl -R on Windows one hour off?
953
Jay Satiroee3c83f2016-11-11 02:48:52 -0500954 Since curl 7.53.0 this issue should be fixed as long as curl was built with
955 any modern compiler that allows for a 64-bit curl_off_t type. For older
956 compilers or prior curl versions it may set a time that appears one hour off.
957 This happens due to a flaw in how Windows stores and uses file modification
958 times and it is not easily worked around. For more details read this:
Viktor Szakats62a71af2018-03-12 18:17:05 +0000959 https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting
Daniel Stenberg1dc0ce92005-06-13 18:33:40 +0000960
Daniel Stenberge30b2062021-12-09 12:03:35 +0100961 4.14 Redirects work in browser but not with curl
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000962
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600963 curl supports HTTP redirects well (see item 3.8). Browsers generally support
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200964 at least two other ways to perform redirects that curl does not:
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000965
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200966 Meta tags. You can write an HTML tag that will cause the browser to redirect
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200967 to another given URL after a certain time.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000968
Kushal Das94ac2ca2022-04-21 17:05:36 +0200969 JavaScript. You can write a JavaScript program embedded in an HTML page that
Daniel Stenberg1a911f72013-08-24 17:13:46 +0200970 redirects the browser to another given URL.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000971
972 There is no way to make curl follow these redirects. You must either
dbrowndan84086b32019-05-23 15:05:29 -0700973 manually figure out what the page is set to do, or write a script that parses
974 the results and fetches the new URL.
Daniel Stenberg09cb9c72005-08-26 13:22:39 +0000975
Daniel Stenberga28464a2021-10-31 16:34:44 +0100976 4.15 FTPS does not work
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000977
978 curl supports FTPS (sometimes known as FTP-SSL) both implicit and explicit
979 mode.
980
981 When a URL is used that starts with FTPS://, curl assumes implicit SSL on
982 the control connection and will therefore immediately connect and try to
983 speak SSL. FTPS:// connections default to port 990.
984
Daniel Stenberg3a4182d2022-03-29 13:58:11 +0200985 To use explicit FTPS, you use an FTP:// URL and the --ftp-ssl option (or one
Daniel Stenberg1640bb62019-02-28 09:09:51 +0100986 of its related flavors). This is the most common method, and the one
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600987 mandated by RFC4217. This kind of connection will then of course use the
Daniel Stenberg844cbc72007-07-29 22:17:39 +0000988 standard FTP port 21 by default.
989
Daniel Stenberge30b2062021-12-09 12:03:35 +0100990 4.16 My HTTP POST or PUT requests are slow
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000991
992 libcurl makes all POST and PUT requests (except for POST requests with a
Daniel Stenberg92efb3d2021-11-01 13:43:11 +0100993 tiny request body) use the "Expect: 100-continue" header. This header
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000994 allows the server to deny the operation early so that libcurl can bail out
railsnewbie257cd6b99e2017-01-11 23:48:22 -0600995 before having to send any data. This is useful in authentication
Daniel Stenberg95df5d02008-09-24 07:50:46 +0000996 cases and others.
997
Daniel Stenberga28464a2021-10-31 16:34:44 +0100998 However, many servers do not implement the Expect: stuff properly and if the
999 server does not respond (positively) within 1 second libcurl will continue
Daniel Stenberg95df5d02008-09-24 07:50:46 +00001000 and send off the data anyway.
1001
1002 You can disable libcurl's use of the Expect: header the same way you disable
1003 any header, using -H / CURLOPT_HTTPHEADER, or by forcing it to use HTTP 1.0.
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001004
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001005 4.17 Non-functional connect timeouts
1006
1007 In most Windows setups having a timeout longer than 21 seconds make no
1008 difference, as it will only send 3 TCP SYN packets and no more. The second
1009 packet sent three seconds after the first and the third six seconds after
Daniel Stenberge30b2062021-12-09 12:03:35 +01001010 the second. No more than three packets are sent, no matter how long the
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001011 timeout is set.
1012
1013 See option TcpMaxConnectRetransmissions on this page:
Viktor Szakats45f21e02015-06-16 00:47:26 +02001014 https://support.microsoft.com/en-us/kb/175523/en-us
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001015
1016 Also, even on non-Windows systems there may run a firewall or anti-virus
1017 software or similar that accepts the connection but does not actually do
1018 anything else. This will make (lib)curl to consider the connection connected
Daniel Stenberga28464a2021-10-31 16:34:44 +01001019 and thus the connect timeout will not trigger.
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001020
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001021 4.18 file:// URLs containing drive letters (Windows, NetWare)
1022
Daniel Stenberg0f199632016-10-18 13:59:54 +02001023 When using curl to try to download a local file, one might use a URL
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001024 in this format:
1025
1026 file://D:/blah.txt
1027
Daniel Stenberga28464a2021-10-31 16:34:44 +01001028 you will find that even if D:\blah.txt does exist, curl returns a 'file
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001029 not found' error.
1030
Viktor Szakats45f21e02015-06-16 00:47:26 +02001031 According to RFC 1738 (https://www.ietf.org/rfc/rfc1738.txt),
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001032 file:// URLs must contain a host component, but it is ignored by
1033 most implementations. In the above example, 'D:' is treated as the
Daniel Stenberg0f199632016-10-18 13:59:54 +02001034 host component, and is taken away. Thus, curl tries to open '/blah.txt'.
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001035 If your system is installed to drive C:, that will resolve to 'C:\blah.txt',
Daniel Stenberga28464a2021-10-31 16:34:44 +01001036 and if that does not exist you will get the not found error.
Daniel Stenbergb8012ea2009-11-07 21:52:41 +00001037
1038 To fix this problem, use file:// URLs with *three* leading slashes:
1039
1040 file:///D:/blah.txt
1041
1042 Alternatively, if it makes more sense, specify 'localhost' as the host
1043 component:
1044
1045 file://localhost/D:/blah.txt
1046
Daniel Stenberg0f199632016-10-18 13:59:54 +02001047 In either case, curl should now be looking for the correct file.
Daniel Stenberg2afb88e2009-02-23 21:21:00 +00001048
Daniel Stenberga28464a2021-10-31 16:34:44 +01001049 4.19 Why does not curl return an error when the network cable is unplugged?
Dan Fandrich7d166b02010-07-21 15:15:07 -07001050
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001051 Unplugging a cable is not an error situation. The TCP/IP protocol stack
Dan Fandrich7d166b02010-07-21 15:15:07 -07001052 was designed to be fault tolerant, so even though there may be a physical
Daniel Stenberga28464a2021-10-31 16:34:44 +01001053 break somewhere the connection should not be affected, just possibly
Daniel Stenberge30b2062021-12-09 12:03:35 +01001054 delayed. Eventually, the physical break will be fixed or the data will be
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001055 re-routed around the physical problem through another path.
Dan Fandrich7d166b02010-07-21 15:15:07 -07001056
1057 In such cases, the TCP/IP stack is responsible for detecting when the
1058 network connection is irrevocably lost. Since with some protocols it is
Daniel Stenberg14f92f22016-01-25 11:11:29 +01001059 perfectly legal for the client to wait indefinitely for data, the stack may
Dan Fandrich7d166b02010-07-21 15:15:07 -07001060 never report a problem, and even when it does, it can take up to 20 minutes
Daniel Stenberge30b2062021-12-09 12:03:35 +01001061 for it to detect an issue. The curl option --keepalive-time enables
Dan Fandrich7d166b02010-07-21 15:15:07 -07001062 keep-alive support in the TCP/IP stack which makes it periodically probe the
1063 connection to make sure it is still available to send data. That should
1064 reliably detect any TCP/IP network failure.
1065
Daniel Stenberge30b2062021-12-09 12:03:35 +01001066 TCP keep alive will not detect the network going down before the TCP/IP
Dan Fandrich7d166b02010-07-21 15:15:07 -07001067 connection is established (e.g. during a DNS lookup) or using protocols that
Daniel Stenberge30b2062021-12-09 12:03:35 +01001068 do not use TCP. To handle those situations, curl offers a number of timeouts
Dan Fandrich7d166b02010-07-21 15:15:07 -07001069 on its own. --speed-limit/--speed-time will abort if the data transfer rate
1070 falls too low, and --connect-timeout and --max-time can be used to put an
1071 overall timeout on the connection phase or the entire transfer.
1072
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001073 A libcurl-using application running in a known physical environment (e.g.
1074 an embedded device with only a single network connection) may want to act
Daniel Stenberge30b2062021-12-09 12:03:35 +01001075 immediately if its lone network connection goes down. That can be achieved
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001076 by having the application monitor the network connection on its own using an
Daniel Stenberg1640bb62019-02-28 09:09:51 +01001077 OS-specific mechanism, then signaling libcurl to abort (see also item 5.13).
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001078
Daniel Stenberge30b2062021-12-09 12:03:35 +01001079 4.20 curl does not return error for HTTP non-200 responses
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001080
1081 Correct. Unless you use -f (--fail).
1082
Daniel Stenberga28464a2021-10-31 16:34:44 +01001083 When doing HTTP transfers, curl will perform exactly what you are asking it
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001084 to do and if successful it will not return an error. You can use curl to
1085 test your web server's "file not found" page (that gets 404 back), you can
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001086 use it to check your authentication protected web pages (that gets a 401
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001087 back) and so on.
1088
1089 The specific HTTP response code does not constitute a problem or error for
1090 curl. It simply sends and delivers HTTP as you asked and if that worked,
1091 everything is fine and dandy. The response code is generally providing more
Daniel Stenberga28464a2021-10-31 16:34:44 +01001092 higher level error information that curl does not care about. The error was
Daniel Stenberg889de6b2014-08-28 11:39:39 +02001093 not in the HTTP transfer.
1094
1095 If you want your command line to treat error codes in the 400 and up range
1096 as errors and thus return a non-zero value and possibly show an error
1097 message, curl has a dedicated option for that: -f (CURLOPT_FAILONERROR in
1098 libcurl speak).
1099
Daniel Stenbergaccbbd72014-08-28 11:42:00 +02001100 You can also use the -w option and the variable %{response_code} to extract
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001101 the exact response code that was returned in the response.
Daniel Stenbergaccbbd72014-08-28 11:42:00 +02001102
Daniel Stenbergc3318b42000-08-17 14:06:42 +000011035. libcurl Issues
Daniel Stenberg29470102000-06-02 13:32:01 +00001104
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001105 5.1 Is libcurl thread-safe?
Daniel Stenberg29470102000-06-02 13:32:01 +00001106
Daniel Stenberg7d09e512001-01-11 12:52:07 +00001107 Yes.
1108
Dan Fandrichec2ad572005-04-13 19:31:00 +00001109 We have written the libcurl code specifically adjusted for multi-threaded
Daniel Stenberg7d09e512001-01-11 12:52:07 +00001110 programs. libcurl will use thread-safe functions instead of non-safe ones if
Daniel Stenberge30b2062021-12-09 12:03:35 +01001111 your system has such. Note that you must never share the same handle in
Dan Fandrich31c6e7a2013-04-15 22:26:18 +02001112 multiple threads.
1113
Jay Satirobefa21f2016-05-05 14:34:27 -04001114 There may be some exceptions to thread safety depending on how libcurl was
1115 built. Please review the guidelines for thread safety to learn more:
Daniel Stenberg4d2f8002020-11-04 14:02:01 +01001116 https://curl.se/libcurl/c/threadsafe.html
Daniel Stenberg7f70dbc2007-02-12 22:32:37 +00001117
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001118 5.2 How can I receive all data into a large memory chunk?
1119
Daniel Stenberga84af982001-05-15 13:09:27 +00001120 [ See also the examples/getinmemory.c source ]
1121
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001122 You are in full control of the callback function that gets called every time
1123 there is data received from the remote server. You can make that callback do
Daniel Stenberg4c485992001-04-22 15:45:27 +00001124 whatever you want. You do not have to write the received data to a file.
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001125
1126 One solution to this problem could be to have a pointer to a struct that you
1127 pass to the callback function. You set the pointer using the
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001128 CURLOPT_WRITEDATA option. Then that pointer will be passed to the callback
1129 instead of a FILE * to a file:
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001130
1131 /* imaginary struct */
1132 struct MemoryStruct {
1133 char *memory;
1134 size_t size;
1135 };
1136
1137 /* imaginary callback function */
1138 size_t
1139 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
1140 {
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001141 size_t realsize = size * nmemb;
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001142 struct MemoryStruct *mem = (struct MemoryStruct *)data;
Daniel Stenbergeea22872004-03-16 07:56:51 +00001143
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001144 mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
1145 if (mem->memory) {
1146 memcpy(&(mem->memory[mem->size]), ptr, realsize);
1147 mem->size += realsize;
1148 mem->memory[mem->size] = 0;
1149 }
1150 return realsize;
1151 }
1152
Daniel Stenberg2c100372000-12-19 07:30:51 +00001153 5.3 How do I fetch multiple files with libcurl?
Daniel Stenbergec5ac822000-12-14 08:37:09 +00001154
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001155 libcurl has excellent support for transferring multiple files. You should
1156 just repeatedly set new URLs with curl_easy_setopt() and then transfer it
1157 with curl_easy_perform(). The handle you get from curl_easy_init() is not
Daniel Stenberga28464a2021-10-31 16:34:44 +01001158 only reusable, but you are even encouraged to reuse it if you can, as that
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001159 will enable libcurl to use persistent connections.
Daniel Stenberga40b55d2000-11-22 07:27:26 +00001160
Daniel Stenbergbc5954f2001-03-23 08:16:24 +00001161 5.4 Does libcurl do Winsock initialization on win32 systems?
Daniel Stenberg910fc852000-12-30 11:48:51 +00001162
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001163 Yes, if told to in the curl_global_init() call.
Daniel Stenberg910fc852000-12-30 11:48:51 +00001164
Daniel Stenberg7e3cd822003-12-08 13:59:35 +00001165 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
Daniel Stenberg41084e52001-01-22 08:42:00 +00001166
1167 Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
Daniel Stenberg7e3cd822003-12-08 13:59:35 +00001168 that DLL use the FILE * (as the DLL and the client application cannot access
1169 each others' variable memory areas). If you set CURLOPT_WRITEDATA you must
1170 also use CURLOPT_WRITEFUNCTION as well to set a function that writes the
1171 file, even if that simply writes the data to the specified FILE *.
1172 Similarly, if you use CURLOPT_READDATA you must also specify
1173 CURLOPT_READFUNCTION.
Daniel Stenberg41084e52001-01-22 08:42:00 +00001174
Daniel Stenberg4c485992001-04-22 15:45:27 +00001175 5.6 What about Keep-Alive or persistent connections?
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +00001176
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001177 curl and libcurl have excellent support for persistent connections when
Daniel Stenberg490879e2020-11-05 13:06:00 +01001178 transferring several files from the same server. curl will attempt to reuse
Daniel Stenbergdb5c9cd2003-02-25 08:52:32 +00001179 connections for all URLs specified on the same command line/config file, and
1180 libcurl will reuse connections for all transfers that are made using the
1181 same libcurl handle.
Daniel Stenberg6dc5c6f2001-01-27 20:51:31 +00001182
Daniel Stenberg6d496952017-05-12 19:58:06 +02001183 When you use the easy interface the connection cache is kept within the easy
1184 handle. If you instead use the multi interface, the connection cache will be
1185 kept within the multi handle and will be shared among all the easy handles
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001186 that are used within the same multi handle.
Daniel Stenbergc9a82f32011-06-21 08:44:42 +02001187
Daniel Stenberge30b2062021-12-09 12:03:35 +01001188 5.7 Link errors when building libcurl on Windows
Daniel Stenbergdd82d692002-10-08 07:16:17 +00001189
1190 You need to make sure that your project, and all the libraries (both static
1191 and dynamic) that it links against, are compiled/linked against the same run
1192 time library.
1193
1194 This is determined by the /MD, /ML, /MT (and their corresponding /M?d)
1195 options to the command line compiler. /MD (linking against MSVCRT dll) seems
1196 to be the most commonly used option.
1197
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001198 When building an application that uses the static libcurl library, you must
1199 add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for
Daniel Stenberga28464a2021-10-31 16:34:44 +01001200 dynamic import symbols. If you are using Visual Studio, you need to instead
Daniel Stenberg6ce76e62010-09-08 23:23:19 +02001201 add CURL_STATICLIB in the "Preprocessor Definitions" section.
1202
Antoine Pietrib341b762022-01-27 02:12:50 +01001203 If you get a linker error like "unknown symbol __imp__curl_easy_init ..." you
Daniel Stenberge30b2062021-12-09 12:03:35 +01001204 have linked against the wrong (static) library. If you want to use the
Daniel Stenberga28464a2021-10-31 16:34:44 +01001205 libcurl.dll and import lib, you do not need any extra CFLAGS, but use one of
Daniel Stenberg6ce76e62010-09-08 23:23:19 +02001206 the import libraries below. These are the libraries produced by the various
1207 lib/Makefile.* files:
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001208
Daniel Stenberg77110862011-03-14 13:31:05 +01001209 Target: static lib. import lib for libcurl*.dll.
1210 -----------------------------------------------------------
1211 MingW: libcurl.a libcurldll.a
1212 MSVC (release): libcurl.lib libcurl_imp.lib
1213 MSVC (debug): libcurld.lib libcurld_imp.lib
1214 Borland: libcurl.lib libcurl_imp.lib
Gisle Vanem51a87fa2004-11-24 15:14:42 +00001215
Daniel Stenberg9754b202010-08-11 09:15:43 +02001216 5.8 libcurl.so.X: open failed: No such file or directory
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001217
1218 This is an error message you might get when you try to run a program linked
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001219 with a shared version of libcurl and your runtime linker (ld.so) could not
Daniel Stenberg9754b202010-08-11 09:15:43 +02001220 find the shared library named libcurl.so.X. (Where X is the number of the
1221 current libcurl ABI, typically 3 or 4).
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001222
Daniel Stenberg9754b202010-08-11 09:15:43 +02001223 You need to make sure that ld.so finds libcurl.so.X. You can do that
Daniel Stenberge30b2062021-12-09 12:03:35 +01001224 multiple ways, and it differs somewhat between different operating systems.
1225 They are usually:
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001226
1227 * Add an option to the linker command line that specify the hard-coded path
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001228 the runtime linker should check for the lib (usually -R)
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001229
1230 * Set an environment variable (LD_LIBRARY_PATH for example) where ld.so
1231 should check for libs
1232
Daniel Stenberga28464a2021-10-31 16:34:44 +01001233 * Adjust the system's config to check for libs in the directory where you have
Kushal Das94ac2ca2022-04-21 17:05:36 +02001234 put the library (like Linux's /etc/ld.so.conf)
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001235
1236 'man ld.so' and 'man ld' will tell you more details
1237
Daniel Stenberg1d323362004-08-12 14:09:10 +00001238 5.9 How does libcurl resolve host names?
1239
Daniel Stenberge30b2062021-12-09 12:03:35 +01001240 libcurl supports a large number of name resolve functions. One of them is
1241 picked at build-time and will be used unconditionally. Thus, if you want to
1242 change name resolver function you must rebuild libcurl and tell it to use a
1243 different function.
Daniel Stenberg1d323362004-08-12 14:09:10 +00001244
Daniel Stenberg6d496952017-05-12 19:58:06 +02001245 - The non-IPv6 resolver that can use one of four different host name resolve
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001246 calls (depending on what your system supports):
Daniel Stenberg1d323362004-08-12 14:09:10 +00001247
Daniel Stenberg77110862011-03-14 13:31:05 +01001248 A - gethostbyname()
1249 B - gethostbyname_r() with 3 arguments
1250 C - gethostbyname_r() with 5 arguments
1251 D - gethostbyname_r() with 6 arguments
Daniel Stenberg1d323362004-08-12 14:09:10 +00001252
Steve Holme151ae592014-12-27 11:09:01 +00001253 - The IPv6-resolver that uses getaddrinfo()
Daniel Stenberg1d323362004-08-12 14:09:10 +00001254
1255 - The c-ares based name resolver that uses the c-ares library for resolves.
Daniel Stenbergfa811932011-04-14 23:12:27 +02001256 Using this offers asynchronous name resolves.
Daniel Stenberg1d323362004-08-12 14:09:10 +00001257
Daniel Stenberg18a9ee62010-06-30 15:52:58 +02001258 - The threaded resolver (default option on Windows). It uses:
Daniel Stenberg1d323362004-08-12 14:09:10 +00001259
Steve Holme151ae592014-12-27 11:09:01 +00001260 A - gethostbyname() on plain IPv4 hosts
1261 B - getaddrinfo() on IPv6 enabled hosts
Daniel Stenbergdd82d692002-10-08 07:16:17 +00001262
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001263 Also note that libcurl never resolves or reverse-lookups addresses given as
1264 pure numbers, such as 127.0.0.1 or ::1.
1265
1266 5.10 How do I prevent libcurl from writing the response to stdout?
1267
1268 libcurl provides a default built-in write function that writes received data
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001269 to stdout. Set the CURLOPT_WRITEFUNCTION to receive the data, or possibly
1270 set CURLOPT_WRITEDATA to a different FILE * handle.
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001271
Daniel Stenberg6e8e0412005-04-05 14:38:38 +00001272 5.11 How do I make libcurl not receive the whole HTTP response?
1273
1274 You make the write callback (or progress callback) return an error and
1275 libcurl will then abort the transfer.
1276
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001277 5.12 Can I make libcurl fake or hide my real IP address?
1278
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001279 No. libcurl operates on a higher level. Besides, faking IP address would
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001280 imply sending IP packets with a made-up source address, and then you normally
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001281 get a problem with receiving the packet sent back as they would then not be
Daniel Stenberge30b2062021-12-09 12:03:35 +01001282 routed to you.
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001283
1284 If you use a proxy to access remote sites, the sites will not see your local
1285 IP address but instead the address of the proxy.
1286
1287 Also note that on many networks NATs or other IP-munging techniques are used
1288 that makes you see and use a different IP address locally than what the
Daniel Stenberg1a911f72013-08-24 17:13:46 +02001289 remote server will see you coming from. You may also consider using
Viktor Szakats45f21e02015-06-16 00:47:26 +02001290 https://www.torproject.org/ .
Daniel Stenbergb5d50e92005-04-11 13:39:55 +00001291
Daniel Stenberg24602ed2007-12-10 10:28:56 +00001292 5.13 How do I stop an ongoing transfer?
1293
Daniel Stenberg4b837a72011-01-24 22:18:43 +01001294 With the easy interface you make sure to return the correct error code from
1295 one of the callbacks, but none of them are instant. There is no function you
1296 can call from another thread or similar that will stop it immediately.
Dan Fandrichb3740f02011-06-02 18:41:57 -07001297 Instead, you need to make sure that one of the callbacks you use returns an
Daniel Stenberge30b2062021-12-09 12:03:35 +01001298 appropriate value that will stop the transfer. Suitable callbacks that you
Dan Fandrichb3740f02011-06-02 18:41:57 -07001299 can do this with include the progress callback, the read callback and the
1300 write callback.
Daniel Stenberg24602ed2007-12-10 10:28:56 +00001301
Daniel Stenberga28464a2021-10-31 16:34:44 +01001302 If you are using the multi interface, you can also stop a transfer by
Dan Fandrichb3740f02011-06-02 18:41:57 -07001303 removing the particular easy handle from the multi stack at any moment you
Daniel Stenberg9ca812f2013-02-04 22:46:51 +01001304 think the transfer is done or when you wish to abort the transfer.
Daniel Stenberge9eb5232005-04-05 14:36:37 +00001305
Daniel Stenberg22059852008-09-24 07:39:42 +00001306 5.14 Using C++ non-static functions for callbacks?
1307
Daniel Stenberga28464a2021-10-31 16:34:44 +01001308 libcurl is a C library, it does not know anything about C++ member functions.
Daniel Stenberg22059852008-09-24 07:39:42 +00001309
railsnewbie257cd6b99e2017-01-11 23:48:22 -06001310 You can overcome this "limitation" with relative ease using a static
Daniel Stenberg22059852008-09-24 07:39:42 +00001311 member function that is passed a pointer to the class:
1312
1313 // f is the pointer to your object.
Stephen Brokenshire2a1d5382016-10-01 16:36:50 +01001314 static size_t YourClass::func(void *buffer, size_t sz, size_t n, void *f)
Daniel Stenberg22059852008-09-24 07:39:42 +00001315 {
1316 // Call non-static member function.
1317 static_cast<YourClass*>(f)->nonStaticFunction();
1318 }
1319
1320 // This is how you pass pointer to the static function:
Stephen Brokenshire2a1d5382016-10-01 16:36:50 +01001321 curl_easy_setopt(hcurl, CURLOPT_WRITEFUNCTION, YourClass::func);
Daniel Stenberg22059852008-09-24 07:39:42 +00001322 curl_easy_setopt(hcurl, CURLOPT_WRITEDATA, this);
1323
Yang Tsea07bc792010-02-14 19:40:18 +00001324 5.15 How do I get an FTP directory listing?
Daniel Stenberg8740d142009-06-09 09:02:39 +00001325
1326 If you end the FTP URL you request with a slash, libcurl will provide you
1327 with a directory listing of that given directory. You can also set
1328 CURLOPT_CUSTOMREQUEST to alter what exact listing command libcurl would use
1329 to list the files.
1330
Jay Satirof9eed592016-07-09 03:05:55 -04001331 The follow-up question tends to be how is a program supposed to parse the
Kushal Das94ac2ca2022-04-21 17:05:36 +02001332 directory listing. How does it know what's a file and what's a directory and
1333 what's a symlink etc. If the FTP server supports the MLSD command then it
1334 will return data in a machine-readable format that can be parsed for type.
1335 The types are specified by RFC3659 section 7.5.1. If MLSD is not supported
1336 then you have to work with what you are given. The LIST output format is
1337 entirely at the server's own liking and the NLST output does not reveal any
1338 types and in many cases does not even include all the directory entries.
1339 Also, both LIST and NLST tend to hide unix-style hidden files (those that
1340 start with a dot) by default so you need to do "LIST -a" or similar to see
1341 them.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001342
Jay Satirof9eed592016-07-09 03:05:55 -04001343 Example - List only directories.
1344 ftp.funet.fi supports MLSD and ftp.kernel.org does not:
1345
1346 curl -s ftp.funet.fi/pub/ -X MLSD | \
1347 perl -lne 'print if s/(?:^|;)type=dir;[^ ]+ (.+)$/$1/'
1348
1349 curl -s ftp.kernel.org/pub/linux/kernel/ | \
1350 perl -lne 'print if s/^d[-rwx]{9}(?: +[^ ]+){7} (.+)$/$1/'
1351
1352 If you need to parse LIST output in libcurl one such existing
Viktor Szakatsd49881c2016-02-03 05:09:25 +01001353 list parser is available at https://cr.yp.to/ftpparse.html Versions of
Dan Fandrich7d166b02010-07-21 15:15:07 -07001354 libcurl since 7.21.0 also provide the ability to specify a wildcard to
1355 download multiple files from one FTP directory.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001356
Daniel Stenberge30b2062021-12-09 12:03:35 +01001357 5.16 I want a different time-out
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001358
Daniel Stenberge30b2062021-12-09 12:03:35 +01001359 Sometimes users realize that CURLOPT_TIMEOUT and CURLOPT_CONNECTIMEOUT are
1360 not sufficiently advanced or flexible to cover all the various use cases and
1361 scenarios applications end up with.
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001362
1363 libcurl offers many more ways to time-out operations. A common alternative
1364 is to use the CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME options to
1365 specify the lowest possible speed to accept before to consider the transfer
1366 timed out.
1367
1368 The most flexible way is by writing your own time-out logic and using
Daniel Stenberg7f555dc2017-10-09 16:13:27 +02001369 CURLOPT_XFERINFOFUNCTION (perhaps in combination with other callbacks) and
Daniel Stenberge8ab9a02012-09-28 15:50:18 +02001370 use that to figure out exactly when the right condition is met when the
1371 transfer should get stopped.
1372
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001373 5.17 Can I write a server with libcurl?
1374
1375 No. libcurl offers no functions or building blocks to build any kind of
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001376 Internet protocol server. libcurl is only a client-side library. For server
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001377 libraries, you need to continue your search elsewhere but there exist many
Daniel Stenberge30b2062021-12-09 12:03:35 +01001378 good open source ones out there for most protocols you could want a server
1379 for. There are also really good stand-alone servers that have been tested
Kushal Das94ac2ca2022-04-21 17:05:36 +02001380 and proven for many years. There is no need for you to reinvent them.
Daniel Stenbergdbf93a82013-01-03 10:15:02 +01001381
Daniel Stenberg1495f422014-05-08 09:30:35 +02001382 5.18 Does libcurl use threads?
1383
1384 Put simply: no, libcurl will execute in the same thread you call it in. All
1385 callbacks will be called in the same thread as the one you call libcurl in.
1386
1387 If you want to avoid your thread to be blocked by the libcurl call, you make
Daniel Stenberge30b2062021-12-09 12:03:35 +01001388 sure you use the non-blocking multi API which will do transfers
1389 asynchronously - still in the same single thread.
Daniel Stenberg1495f422014-05-08 09:30:35 +02001390
1391 libcurl will potentially internally use threads for name resolving, if it
Daniel Stenberga28464a2021-10-31 16:34:44 +01001392 was built to work like that, but in those cases it will create the child
Daniel Stenberg1495f422014-05-08 09:30:35 +02001393 threads by itself and they will only be used and then killed internally by
1394 libcurl and never exposed to the outside.
Daniel Stenberg8740d142009-06-09 09:02:39 +00001395
Daniel Stenbergc3318b42000-08-17 14:06:42 +000013966. License Issues
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001397
Daniel Stenberg92efb3d2021-11-01 13:43:11 +01001398 curl and libcurl are released under a MIT/X derivative license. The license
1399 is liberal and should not impose a problem for your project. This section is
1400 just a brief summary for the cases we get the most questions. (Parts of this
1401 section was much enhanced by Bjorn Reese.)
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001402
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001403 We are not lawyers and this is not legal advice. You should probably consult
Dan Fandrichc28443c2010-12-08 10:16:25 -08001404 one if you want true and accurate legal insights without our prejudice. Note
1405 especially that this section concerns the libcurl license only; compiling in
1406 features of libcurl that depend on other libraries (e.g. OpenSSL) may affect
1407 the licensing obligations of your application.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001408
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001409 6.1 I have a GPL program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001410
Daniel Stenberge30b2062021-12-09 12:03:35 +01001411 Yes
Daniel Stenberg7d1ef962000-08-14 06:31:59 +00001412
Daniel Stenberge30b2062021-12-09 12:03:35 +01001413 Since libcurl may be distributed under the MIT/X derivative license, it can
1414 be used together with GPL in any software.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001415
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001416 6.2 I have a closed-source program, can I use the libcurl library?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001417
Daniel Stenberge30b2062021-12-09 12:03:35 +01001418 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001419
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001420 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001421
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001422 6.3 I have a BSD licensed program, can I use the libcurl library?
Daniel Stenberg31b8eea2000-08-23 07:27:00 +00001423
Daniel Stenberge30b2062021-12-09 12:03:35 +01001424 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001425
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001426 libcurl does not put any restrictions on the program that uses the library.
Daniel Stenberg31b8eea2000-08-23 07:27:00 +00001427
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001428 6.4 I have a program that uses LGPL libraries, can I use libcurl?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001429
Daniel Stenberge30b2062021-12-09 12:03:35 +01001430 Yes
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001431
Daniel Stenberga28464a2021-10-31 16:34:44 +01001432 The LGPL license does not clash with other licenses.
Daniel Stenbergc3318b42000-08-17 14:06:42 +00001433
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001434 6.5 Can I modify curl/libcurl for my program and keep the changes secret?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001435
Daniel Stenberge30b2062021-12-09 12:03:35 +01001436 Yes
Daniel Stenberg0d181b52001-01-04 12:43:53 +00001437
Daniel Stenberge30b2062021-12-09 12:03:35 +01001438 The MIT/X derivative license practically allows you to do almost anything
1439 with the sources, on the condition that the copyright texts in the sources
1440 are left intact.
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001441
Daniel Stenberg811edcd2004-08-10 08:41:41 +00001442 6.6 Can you please change the curl/libcurl license to XXXX?
Daniel Stenbergc3c77392000-07-31 22:42:34 +00001443
Daniel Stenbergc59baa02001-02-12 10:05:09 +00001444 No.
1445
Daniel Stenberg11d718b2001-03-13 11:47:30 +00001446 We have carefully picked this license after years of development and
1447 discussions and a large amount of people have contributed with source code
1448 knowing that this is the license we use. This license puts the restrictions
1449 we want on curl/libcurl and it does not spread to other programs or
Daniel Stenberg3a552b12003-06-26 11:35:48 +00001450 libraries that use it. It should be possible for everyone to use libcurl or
1451 curl in their projects, no matter what license they already have in use.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001452
Dan Fandrich5c9fff92009-01-30 18:28:29 +00001453 6.7 What are my obligations when using libcurl in my commercial apps?
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001454
1455 Next to none. All you need to adhere to is the MIT-style license (stated in
1456 the COPYING file) which basically says you have to include the copyright
1457 notice in "all copies" and that you may not use the copyright holder's name
1458 when promoting your software.
1459
1460 You do not have to release any of your source code.
1461
1462 You do not have to reveal or make public any changes to the libcurl source
1463 code.
1464
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001465 You do not have to broadcast to the world that you are using libcurl within
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001466 your app.
1467
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001468 All we ask is that you disclose "the copyright notice and this permission
1469 notice" somewhere. Most probably like in the documentation or in the section
1470 where other third party dependencies already are mentioned and acknowledged.
1471
Daniel Stenberg4d2f8002020-11-04 14:02:01 +01001472 As can be seen here: https://curl.se/docs/companies.html and elsewhere,
Daniel Stenberg819dfdd2011-01-29 23:52:40 +01001473 more and more companies are discovering the power of libcurl and take
1474 advantage of it even in commercial environments.
Daniel Stenberg9a44fa82005-11-02 09:34:53 +00001475
1476
Daniel Stenberg9ac76292004-08-18 11:18:36 +000014777. PHP/CURL Issues
1478
1479 7.1 What is PHP/CURL?
1480
1481 The module for PHP that makes it possible for PHP programs to access curl-
Daniel Stenbergb6c876b2005-07-30 23:37:05 +00001482 functions from within PHP.
1483
1484 In the cURL project we call this module PHP/CURL to differentiate it from
1485 curl the command line tool and libcurl the library. The PHP team however
1486 does not refer to it like this (for unknown reasons). They call it plain
Daniel Stenberg844cbc72007-07-29 22:17:39 +00001487 CURL (often using all caps) or sometimes ext/curl, but both cause much
1488 confusion to users which in turn gives us a higher question load.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001489
Daniel Stenberge38a7882011-03-17 11:30:29 +01001490 7.2 Who wrote PHP/CURL?
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001491
MaxGiting05cd55f2015-11-18 23:00:24 -05001492 PHP/CURL was initially written by Sterling Hughes.
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001493
1494 7.3 Can I perform multiple requests using the same handle?
1495
Daniel Stenbergee400f92004-08-19 06:31:29 +00001496 Yes - at least in PHP version 4.3.8 and later (this has been known to not
1497 work in earlier versions, but the exact version when it started to work is
1498 unknown to me).
Daniel Stenberg9ac76292004-08-18 11:18:36 +00001499
Daniel Stenbergee400f92004-08-19 06:31:29 +00001500 After a transfer, you just set new options in the handle and make another
MaxGiting05cd55f2015-11-18 23:00:24 -05001501 transfer. This will make libcurl re-use the same connection if it can.
1502
1503 7.4 Does PHP/CURL have dependencies?
1504
1505 PHP/CURL is a module that comes with the regular PHP package. It depends on
1506 and uses libcurl, so you need to have libcurl installed properly before
1507 PHP/CURL can be used.
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001508
15098. Development
1510
1511 8.1 Why does curl use C89?
1512
Kushal Das94ac2ca2022-04-21 17:05:36 +02001513 As with everything in curl, there is a history and we keep using what we have
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001514 used before until someone brings up the subject and argues for and works on
1515 changing it.
1516
1517 We started out using C89 in the 1990s because that was the only way to write
1518 a truly portable C program and have it run as widely as possible. C89 was for
1519 a long time even necessary to make things work on otherwise considered modern
Daniel Stenberga28464a2021-10-31 16:34:44 +01001520 platforms such as Windows. Today, we do not really know how many users that
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001521 still require the use of a C89 compiler.
1522
1523 We will continue to use C89 for as long as nobody brings up a strong enough
Daniel Stenberga28464a2021-10-31 16:34:44 +01001524 reason for us to change our minds. The core developers of the project do not
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001525 feel restricted by this and we are not convinced that going C99 will offer us
1526 enough of a benefit to warrant the risk of cutting off a share of users.
1527
1528 8.2 Will curl be rewritten?
1529
1530 In one go: no. Little by little over time? Maybe.
1531
1532 Over the years, new languages and clever operating environments come and go.
1533 Every now and then the urge apparently arises to request that we rewrite curl
1534 in another language.
1535
1536 Some the most important properties in curl are maintaining the API and ABI
1537 for libcurl and keeping the behavior for the command line tool. As long as we
1538 can do that, everything else is up for discussion. To maintain the ABI, we
1539 probably have to maintain a certain amount of code in C, and to remain rock
1540 stable, we will never risk anything by rewriting a lot of things in one go.
1541 That said, we can certainly offer more and more optional backends written in
1542 other languages, as long as those backends can be plugged in at build-time.
Daniel Stenberg3a4182d2022-03-29 13:58:11 +02001543 Backends can be written in any language, but should probably provide APIs
Daniel Stenberg352b07f2021-09-13 17:21:38 +02001544 usable from C to ease integration and transition.